package com.qcc.cashier.pos;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

public class JlPosApp extends AppCompatActivity {

        public void payJl(){
            try {
                Intent intent = new Intent();
                ComponentName componentName = new ComponentName("com.xgd.paysdk", "com.xgd.paysdk.PayActivity");
                intent.setComponent(componentName);

                Bundle bundle = new Bundle();
                bundle.putString("appName",  "jlpaysdk");
                bundle.putString("agentId",  "48490000");
                bundle.putString("transId",  "Sale");
                bundle.putString("transData", "{\"amt\":\"0.01\"}");

                intent.putExtras(bundle);
                this.startActivityForResult(intent, 1);
            } catch(ActivityNotFoundException e) {
                //TODO:
            } catch(Exception e) {
                //TODO:
            }
        }

        @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            if (requestCode == 0) {
                Bundle bundle = data.getExtras();
                if (bundle != null) {
                    //...调用方处理交易结果
                }
            }
        }
}
